<?php 
use_stylesheet('list.css');
use_helper('toolsbar');
slot('Toolsbar');
   echo setToolbar('index','contact');
end_slot();

slot('PageTitle',"Contact Overview");
slot('Title',"Contact Overview");

        
?>

<table id="lista">
  <thead>
    <tr>
      <th <?php if ($sf_user->getOrderField()=='name') echo 'class=order'?>><a href="<?php echo url_for('contact')."?orderBy=name"?>">Name</a></th>
      <th <?php if ($sf_user->getOrderField()=='surname') echo 'class=order'?>><a href="<?php echo url_for('contact')."?orderBy=surname"?>">Surname</a></th>
      <th <?php if ($sf_user->getOrderField()=='phone') echo 'class=order'?>><a href="<?php echo url_for('contact')."?orderBy=phone1"?>">Phone</a></th>
      <th <?php if ($sf_user->getOrderField()=='mail') echo 'class=order'?>><a href="<?php echo url_for('contact')."?orderBy=mail1"?>">Mail</a></th>
      <th <?php if ($sf_user->getOrderField()=='address') echo 'class=order'?>><a href="<?php echo url_for('contact')."?orderBy=address1"?>">Address</a></th>
      <th <?php if ($sf_user->getOrderField()=='organization') echo 'class=order'?>><a href="<?php echo url_for('contact')."?orderBy=organization"?>">Organization</a></th>
    </tr>
  </thead>
  <tbody>
        <?php foreach ($contacts as $key=>$contact): $odd = fmod($key, 2) ? 'odd' : 'even'?>
    <tr class="<?php echo $odd ?>">
      <td><a href='<?php echo url_for('contact_show',$contact)?>'><?php echo str_replace("_", " ", $contact->getName()) ?></a></td>
      <td><a href='<?php echo url_for('contact_show',$contact)?>'><?php echo str_replace("_", " ",$contact->getSurname()) ?></a></td> 
      <td><?php echo $contact->getPhone1() ?></td>
      <td><?php echo $contact->getMail1() ?></td>
      <td><?php echo $contact->getAddress1() ?></td>
      <td><?php echo $contact->getOrganization() ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>

  <a href="<?php echo url_for('contact/new') ?>">New</a>
